import Api from '@/utils/request';

const requestApi = new Api('http://localhost:3000/api');

/**
 * 统计用户的所有分类数量
 * @param id
 * @returns {Promise | Promise<any>}
 */
export const countCategories = (id) => {
	return requestApi.connection("get", `/category/countCategories/${id}`);
};

/**
 * 找到当前用户的所有分类
 * @param currentPage
 * @param size
 * @param id
 * @returns {Promise | Promise<any>}
 */
export const findAllCategories = (currentPage, size, id) => {
	return requestApi.connection("get", '/category/categories', {
		currentPage: currentPage,
		size: size,
		id: id,
	})
}

/**
 * 通过id找到分类
 * @param id
 * @returns {Promise | Promise<any>}
 */
export const findCategoryById = (currentPage, size, id) => {
	return requestApi.connection("get", `/category/getCategory`, {
		currentPage: currentPage,
		size: size,
		id: id,
	});
}
